resource "google_healthcare_fhir_store" "default" {
  name    = "<%= ctx[:vars]['fhir_store_name'] %>"
  dataset = google_healthcare_dataset.dataset.id
  version = "R4"

  enable_update_create          = false
  disable_referential_integrity = false
  disable_resource_versioning   = false
  enable_history_import         = false

  labels = {
    label1 = "labelvalue1"
  }

  stream_configs {
    resource_types = ["Observation"]
    bigquery_destination {
      dataset_uri = "bq://${google_bigquery_dataset.bq_dataset.project}.${google_bigquery_dataset.bq_dataset.dataset_id}"
      schema_config {
        recursive_structure_depth = 3
      }
    }
  }
}

resource "google_pubsub_topic" "topic" {
  name     = "<%= ctx[:vars]['pubsub_topic']%>"
}

resource "google_healthcare_dataset" "dataset" {
  name     = "<%= ctx[:vars]['dataset_name'] %>"
  location = "us-central1"
}

resource "google_bigquery_dataset" "bq_dataset" {
  dataset_id    = "<%= ctx[:vars]['bq_dataset_name'] %>"
  friendly_name = "test"
  description   = "This is a test description"
  location      = "US"
  delete_contents_on_destroy = true
}